# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

load("@rules_python//python:defs.bzl", "py_library")
load("@ot_python_deps//:requirements.bzl", "requirement")

package(default_visibility = ["//visibility:public"])

filegroup(
    name = "doc_files",
    srcs = glob(["**/*.md"]),
)

py_library(
    name = "topgen",
    srcs = [
        "__init__.py",
        "gen_top_docs.py",
        "secure_prng.py",
        "validate.py",
    ],
    deps = [
        ":merge",
        ":typing",
        requirement("tabulate"),
        requirement("pycryptodome"),
    ],
)

py_library(
    name = "c_test",
    srcs = ["c_test.py"],
    deps = [
        ":lib",
    ],
)

py_library(
    name = "typing",
    srcs = ["typing.py"],
    deps = [
        "//util/reggen:ip_block",
    ],
)

py_library(
    name = "gen_dv",
    srcs = [
        "gen_dv.py",
        "top.py",
    ],
    deps = [
        "//util/reggen:gen_dv",
        "//util/reggen:ip_block",
        "//util/reggen:params",
        "//util/reggen:window",
        requirement("mako"),
    ],
)

py_library(
    name = "lib",
    srcs = [
        "c.py",
        "intermodule.py",
        "lib.py",
        "resets.py",
        "rust.py",
    ],
    deps = [
        "//util:version_file",
        "//util/reggen:inter_signal",
        "//util/reggen:ip_block",
        "//util/reggen:md_helpers",
        "//util/reggen:validate",
        requirement("hjson"),
        requirement("mako"),
    ],
)

py_library(
    name = "merge",
    srcs = [
        "clocks.py",
        "merge.py",
    ],
    deps = [
        ":lib",
        "//util/reggen:params",
    ],
)

filegroup(
    name = "tpl_files",
    srcs = glob(["**/*.tpl"]),
)
